home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / DIBLK.PAK / DIBLOOK.CPP < prev    next >
C/C++ Source or Header  |  1997-05-06  |  4KB  |  157 lines

  1. // diblook.cpp : Defines the class behaviors for the application.
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1995 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "stdafx.h"
  14. #include "diblook.h"
  15.  
  16. #include "mainfrm.h"
  17. #include "dibdoc.h"
  18. #include "dibview.h"
  19.  
  20. #ifdef _DEBUG
  21. #undef THIS_FILE
  22. static char BASED_CODE THIS_FILE[] = __FILE__;
  23. #endif
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CDibLookApp
  27.  
  28. BEGIN_MESSAGE_MAP(CDibLookApp, CWinApp)
  29.     //{{AFX_MSG_MAP(CDibLookApp)
  30.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  31.     //}}AFX_MSG_MAP
  32.     // Standard file based document commands
  33.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  34.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  35.     // Standard print setup command
  36.     ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
  37. END_MESSAGE_MAP()
  38.  
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CDibLookApp construction
  41. // Place all significant initialization in InitInstance
  42.  
  43. CDibLookApp::CDibLookApp()
  44. {
  45. }
  46.  
  47. /////////////////////////////////////////////////////////////////////////////
  48. // The one and only CDibLookApp object
  49.  
  50. CDibLookApp NEAR theApp;
  51.  
  52. /////////////////////////////////////////////////////////////////////////////
  53. // CDibLookApp initialization
  54.  
  55. BOOL CDibLookApp::InitInstance()
  56. {
  57.     // Standard initialization
  58.     //  (if you are not using these features and wish to reduce the size
  59.     // of your final executable, you should remove the following initialization
  60.  
  61.     Enable3dControls();     // Use 3d controls in dialogs
  62.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  63.  
  64.     // Register document templates which serve as connection between
  65.     //  documents and views.  Views are contained in the specified view
  66.  
  67.     AddDocTemplate(new CMultiDocTemplate(IDR_DIBTYPE,
  68.             RUNTIME_CLASS(CDibDoc),
  69.             RUNTIME_CLASS(CMDIChildWnd),        // standard MDI child frame
  70.             RUNTIME_CLASS(CDibView)));
  71.  
  72.     // create main MDI Frame window
  73.     CMainFrame* pMainFrame = new CMainFrame;
  74.     if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
  75.         return FALSE;
  76.     pMainFrame->ShowWindow(m_nCmdShow);
  77.     pMainFrame->UpdateWindow();
  78.     m_pMainWnd = pMainFrame;
  79.  
  80.     // enable file manager drag/drop and DDE Execute open
  81.     m_pMainWnd->DragAcceptFiles();
  82.  
  83.     EnableShellOpen();
  84.     RegisterShellFileTypes(TRUE);
  85.  
  86.     // Parse command line for standard shell commands, DDE, file open
  87.     CCommandLineInfo cmdInfo;
  88.     ParseCommandLine(cmdInfo);
  89.  
  90.     // Dispatch commands specified on the command line
  91.     if (!ProcessShellCommand(cmdInfo))
  92.         return FALSE;
  93.  
  94.     return TRUE;
  95. }
  96.  
  97. #ifdef _MAC
  98.  
  99. BOOL CDibLookApp::CreateInitialDocument()
  100. {
  101.     // do *not* create a new (empty) document, but do return TRUE since no
  102.     // failure occurred
  103.  
  104.     return TRUE;
  105. }
  106.  
  107. #endif
  108.  
  109. /////////////////////////////////////////////////////////////////////////////
  110. // CAboutDlg dialog used for App About
  111.  
  112. class CAboutDlg : public CDialog
  113. {
  114. public:
  115.     CAboutDlg() : CDialog(CAboutDlg::IDD)
  116.         {
  117.             //{{AFX_DATA_INIT(CAboutDlg)
  118.             //}}AFX_DATA_INIT
  119.         }
  120.  
  121. // Dialog Data
  122.     //{{AFX_DATA(CAboutDlg)
  123.         enum { IDD = IDD_ABOUTBOX };
  124.     //}}AFX_DATA
  125.  
  126. // Implementation
  127. protected:
  128.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  129.     //{{AFX_MSG(CAboutDlg)
  130.         // No message handlers
  131.     //}}AFX_MSG
  132.     DECLARE_MESSAGE_MAP()
  133. };
  134.  
  135. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  136. {
  137.     CDialog::DoDataExchange(pDX);
  138.     //{{AFX_DATA_MAP(CAboutDlg)
  139.     //}}AFX_DATA_MAP
  140. }
  141.  
  142. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  143.     //{{AFX_MSG_MAP(CAboutDlg)
  144.         // No message handlers
  145.     //}}AFX_MSG_MAP
  146. END_MESSAGE_MAP()
  147.  
  148. // App command to run the dialog
  149. void CDibLookApp::OnAppAbout()
  150. {
  151.     CAboutDlg aboutDlg;
  152.     aboutDlg.DoModal();
  153. }
  154.  
  155. /////////////////////////////////////////////////////////////////////////////
  156. // CDibLookApp commands
  157.